home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / gus / sdkdigv2.zip / SDKV2N31.TXT < prev    next >
Text File  |  1993-07-30  |  10KB  |  233 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. GUS Programmer's Digest     Fri Jul 30 00:07     Volume 2: Issue  31  
  7.  
  8. Today's Topics:
  9.                     GUS Programmer's Digest V2 #30
  10.                             SDK questions
  11.               WARNING: Lists running blind for a week...
  12.  
  13. Standard Info:
  14.     - Meta-info about the GUS can be found at the end of the Digest.
  15.     - Before you ask a question, please READ THE FAQ.
  16.  
  17. ----------------------------------------------------------------------
  18.  
  19. Date: Thu, 29 Jul 1993 12:51:56 -0400
  20. From: jericho!gord (Gord Wait S-MOS Systems Vancouver Design Center)
  21. Subject: Re: GUS Programmer's Digest V2 #30
  22. Message-ID: <9307291651.AA04444@smos.bc.ca>
  23.  
  24. RE: SDK questions:
  25.  
  26. The only question I can help you on is the centerpoint. I beleive 
  27. the centerpoint to be 80 hex. I don't know if there is an "official"
  28. spec on this. Note that if you use USS8 and fade a section of audio
  29. to completely 0, that it ends up at 80 hex. Note also that the GUS's 8 bit
  30. in ports are not well zero'ed. My card zero's out at 7e (left channel)
  31. and 81 (right channel). Other peoples cards are different. I wrote
  32. a little test and fix program (sndfix.zip in the archives) to find out
  33. what your card is set to, and then use the program as a filter to
  34. correct samples after they are recorded. (IE add or subtract to set 
  35. the sample back to 80 hex as a center point).
  36.  
  37. I wrote this after I found pops and clicks while pasting audio samples
  38. into sections of silence in USS8. 
  39.  
  40. ------------------------------
  41.  
  42. Date: Thu, 29 Jul 93 4:58:16 EDT
  43. From: Phat H Tran <ptran@sciborg.uwaterloo.ca>
  44. Subject: SDK questions
  45. Message-ID: <9307290858.AA24596@sciborg.uwaterloo.ca>
  46.  
  47. > Date: Wed, 28 Jul 1993 12:11:07 -0700 (PDT)
  48. > From: roberts@brahms.amd.com (Dave Roberts)
  49. > Subject: SDK Doc Questions still
  50. > Message-ID: <9307281911.AA10717@angelo.amd.com>
  51. >
  52. [...] 
  53.  
  54. I was also waiting for a reply to your message as well to see if what
  55. I've internalized about the GUS after reading the SDK doc is close to 
  56. reality.  But since no one has replied, I'll give you my version of 
  57. the answers to your questions and hope people will correct me where
  58. I'm wrong. :)
  59.  
  60. > Question #1:
  61. > How does looping work?  Specifically, how does reverse looping
  62. > operate?  What are the end points?  What are all the various looping
  63. > options?  The docs mention resetting end points to deal with sampled
  64. > decays.  What are the exact steps involved with this?  How do you
  65. > handle decay without using a sampled decay?  Just a volume ramp down
  66. > until you get to zero and then shut off the voice?
  67.  
  68. On the most basic of levels, a voice can play a sample with three points:
  69. the sample begin point, the loop start point, and the loop end point.
  70.  
  71.             |-----------------|--------------|
  72.           Begin             Start           End
  73.                --> direction of voice travel
  74.  
  75. These points are all absolute addresses in the GUS' DRAM, not table
  76. offsets.  You would store the Begin address in registers 0Ah & 0Bh
  77. (these hold the current address of the voice), the loop Start address 
  78. in registers 02h & 03h, and the loop End address in registers 04h & 05h.
  79. Once the appropriate bits are set and cleared in the control register,
  80. the voice will start advancing in the direction shown.  Note that the
  81. registers used to hold the Begin address (0Ah & 0Bh) will get updated
  82. as the voice moves, so they must be restored if you want to restart
  83. the voice.  Once the voice hits the End address, the address in 
  84. registers 02h & 03h will be loaded into registers (0Ah & 0Bh), thereby
  85. repositioning the voice at the Start address, and the voice will 
  86. continue advancing from that point.  This repeats for as long as looping 
  87. is enabled.  For note-off, a volume ramp to zero can be used to synthesize 
  88. a decay.
  89.  
  90. You can also implement a sampled decay.  Consider the following sample
  91. uploaded to the GUS:
  92.  
  93.             |-----------------|-------------|----------------|
  94.           Begin             Start          End           Decay End
  95.                --> direction of voice travel
  96.  
  97. The Begin, Start, and End address are all stored in the same registers
  98. as in the previous case.  Starting the voice (with looping enabled)
  99. through the control register is also done in the same manner as before.
  100. The difference is that for note-off, instead of implementing a volume
  101. ramp, looping is first disabled, and then the Decay End address is
  102. stored in registers 04h & 05h (which used to hold the loop End address).
  103. That way, instead of looping the segment between Start and End, the voice 
  104. wanders off into the sampled decay, and stops once it hits the end.
  105.  
  106. Reverse looping is identical except that the sample points are flipped
  107. around and the Starting Address and Ending Address registers swap
  108. roles (I think).  Anyway, there's not much use that I can see in 
  109. reverse looping.  Bidirectional looping, OTOH, can be useful.  Same
  110. concepts as above, but instead of snapping back to Start once it
  111. hits End, the voice just reverses direction.  It reverses direction
  112. again once it hits Start, and so on.
  113.  
  114. > Question #2:
  115. > The voice control registers have bits that can be modified at any time
  116. > by the GF1.  The GF1 does a read-modify-write cycle to update these
  117. > bits.  The SDK docs say that when writing to a register containing one
  118. > of these bits that the software should write the value twice,
  119. > separated by a delay (which is specified by I don't remember).  Anyway,
  120. > this is all fine and dandy, but imagine this situation.
  121. > Voice control reigster, bit 6, controls the direction of movement
  122. > through the wave.  What if I (the program) want to update a bit in the
  123. > register.  I read the register value, modify the bit I want, and write
  124. > it back twice.  What if the GF1, between the program's writes changes
  125. > the direction of movement bit (because it was set to a loop mode and
  126. > hit the end of the loop points and is now bouncing back the other
  127. > way)?  The problem that I see is that I (the program) will end up
  128. > setting the direction of movement bit back to the old value, which
  129. > will start the wave back bouncing the other way before it reaches the
  130. > other loop point.  Am I right with this, or do I not understand
  131. > looping?  Is this a problem?  Is there a workaround other than, "don't
  132. > do that"?
  133.  
  134. Good question!  Here's a possible solution:  Before the second write, 
  135. read the register again and note what state bit 6 is in and set bit 6
  136. of the byte that you're re-writing to the control register to the same 
  137. state.  The reread must take place after the delay.  That way, if bit 6
  138. changes during the access period, its new state will be reflected in 
  139. the second write to the register.
  140.  
  141. The GUS occasionally squawks, so I think that its current drivers 
  142. are corrupting some of its self-modifying bits.  Perhaps a read 
  143. before the second write to protect sensitive bits will get rid of 
  144. these squawks?
  145.  
  146. > Question #3:
  147. > One page 4 of the SDK docs they are describing volume ramping.  There
  148. > is a table that describes the rate bits.  The table mentions something
  149. > called a "FUR".  What's a FUR?
  150. >
  151.  
  152. Just an adhoc term defined for the formulae on that page, I presume.
  153.  
  154. > Question #4:
  155. > What is the centerpoint for unsigned waveforms, 7F or 80 (hex)?
  156. >
  157.  
  158. I think it could be either.  But the GUS uses signed data internally,
  159. and when it converts 7Fh to signed form (by inverting bit 7 during the
  160. DMA transfer), it comes up with -1.  OTOH, converting 80h to its signed
  161. form by the GUS' method yields 0.  Therefore, use 80h as the centrepoint 
  162. for your unsigned data.
  163.  
  164. > Thanks for any help you gurus might be able to give.
  165.  
  166. You're welcome.  I hope I haven't made any serious mistakes.  I'm not
  167. really a programmer, nor an engineer, but a biochem student, so you're
  168. taking your chances with my "help". :)
  169.  
  170. Phat.
  171.  
  172. ------------------------------
  173.  
  174. Date: Thu, 29 Jul 1993 15:11:01 -0600 (CDT)
  175. From: ddebry@grue.dsd.ES.COM (Dave DeBry)
  176. Subject: WARNING: Lists running blind for a week...
  177. Message-ID: <9307292111.AA06617@grue>
  178.  
  179.     [This message is being sent to all the lists I maintain.  If
  180. you are multiple lists, you're going to get multiple copies.  Live
  181. with it.]
  182.  
  183.     I'm going to be out of town (at SIGGRAPH, actually... if you
  184. are going, let me know... it would be nice to meet some of you) and
  185. away from the mailing lists until August 9th.  You folks are all big
  186. grown-up list users now, so Mom and I decided it's okay to leave you
  187. alone for the week.  (Now watch us get hauled off to jail like that
  188. couple from Chicago. :) The emergency numbers are by the phone,
  189. there's a lot of food in the pantry...
  190.  
  191.     If any trouble comes up, deal with it.  If anything REAL bad
  192. comes up, mail to postmaster@dsd.es.com.  This is only in the worst
  193. case scenario though; their solution will be to just shut all the
  194. lists down until I get back (and then I might not be allowed to turn
  195. them back on).
  196.  
  197.     Have fun while I'm gone.  You can have friends over, but no
  198. big parties.  Ahem... Mike?  Yes, you.  Mr. Biesele.  Pay attention.
  199. (Inside joke.  Most of you can just ignore it.)
  200.  
  201. -- 
  202. Dave  ddebry@ debry@   \
  203. DeBry dsd.    peruvian. | "All right!  I admit it!  I wash my socks in
  204.       es.     cs.utah.  |  club soda so my feet will fizz!"
  205.       com     edu      /
  206.  
  207. ------------------------------
  208.  
  209. End of GUS Programmer's Digest V2 #31
  210. *************************************
  211.  
  212. To post to tomorrow's digest:               <gus-sdk%itchy@dsd.es.com>
  213. To (un)subscribe or get help:       <gus-sdk-request%itchy@dsd.es.com>
  214. To contact a human (last resort):     <gus-sdk-owner%itchy@dsd.es.com>
  215.  
  216. FTP sites:         archive.epas.utoronto.ca         pub/pc/ultrasound
  217.                    wuarchive.wustl.edu       systems/msdos/ultrasound
  218. Hints:
  219.       - Get the FAQ from the FTP sites or the request server.
  220.       - Mail to <gus-sdk-request%itchy@dsd.es.com> for info about
  221.     other GUS related mailing lists (UNIX, OS/2, GUS-MIDI, etc.)
  222.  
  223.  
  224.